<!DOCTYPE html>
<html lang="en">
<head>
	<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, maximum-scale=1, user-scalable=no" charset="UTF-8">
	<link rel="stylesheet" href="android_asset://css/style.css"/>
    <link rel="stylesheet" href="android_asset://css/font.css"/>
	<title>评价</title>
</head>
<body>
<form class="form-horizontal" id="form"  style="position: relative;" action="/tickets/{{ticketId}}/evaluate">
    <input type="hidden" name="evaluateresults"/>
    <input type="hidden" name="action" value="evaluate"> 
	<input type="hidden" name="ticketid" value="{{ticketId}}">
    <div class="evaluate">
      <div class="marbot">
	      <div class="user">
	        <dl>
	          <dt><img src="android_asset://default.png" alt=""></dt>
	          <dd>
	            <h4>工程师：{{engineer.name}}</h4>
	            <p>{{engineer.position}}</p>
	            <p>{{ticketEx.formatpickuptime}}  ～  {{ticketEx.formatactualcompletetime}}</p>
	          </dd>
	        </dl>
	      </div>
	      <div class="assess">
	        <p>最终服务客户：{{ticketEx.actuallcustomer}}  {{ticketEx.actuallcustomerphone}}</p>
	        <p>您对本次工单服务的评价是：</p>
	        <ul>
	          <li class="cir" onclick="mark(this,3)">差</li>
	          <li class="cir" onclick="mark(this,2)">一般</li>
	          <li class="cir" onclick="mark(this,1)">赞</li>
	          <li class="cir" onclick="mark(this,0)">超赞</li>
	        </ul>
	      </div>
	      <div class="voice" onclick="msAndroid.voice('.marbot','single')">
	        <p>点击可录音</p>
	        <b class="cir on right"><span class="icon-mic"></span></b>
	      </div>
      
	      <!--  <div class="voice-over">
	        <div class="bar left">
	          <span class="icon-wifi"></span>
	          <span class="right">15"</span>
	        </div>
	        <p class="left"><span class="icon-delete"></span></p>
	      </div>-->
      
      <!-- <div class="layer hidden">
        <span class="icon-mic"></span>
        <p>录音中...</p>
      </div> -->
      </div>
      <div class="confirm clearfix">
        <button type="button" class="but"><a href="javascript:;">评价</a></button>
      </div>
    </div>
</form>    
</body>
<script src="android_asset://jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="android_asset://jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="android_asset://bridge.js" type="text/javascript"></script>
<script src="android_asset://android.js" type="text/javascript"></script>
<script>
$(function(){
	  $('b.cir').on('keydown touchstart', function () {
		  $(this).css("background", '#3a83d0');
		  $(this).css("border", '1px solid #3a83d0');
		  $(this).find("span").css("color", '#fff');
	  });
	  $('b.cir').on('keyup touchend', function () {
	      $(this).css("background", '#fff');
	      $(this).css("border", '1px solid #ccc');
	       $(this).find("span").css("color", '#ccc');
	  });
	  
	  $('button.but').on('keydown touchstart', function () {
		  $(this).css("background", '#216cb9');
	  });
	  $('button.but').on('keyup touchend', function () {
	      $(this).css("background", '#3e8ddd');
	  });
});


	var liwin=$(".cir").width();
	$(".cir").css({
	  "height":liwin,
	  'lineHeight':liwin+'px'
	});
    //评分  
	function mark(li,score){
		$("ul>li").each(function(index,el){
			$(el).removeClass("on");
		})
		$(li).addClass("on");
		$("input[name='evaluateresults']").val(score);
	};
	//确认
	$(".confirm button").click(function(){
		//评价必选
		var evaluateresults = $("input[name='evaluateresults']").val();
		if(evaluateresults == "" || evaluateresults == null){
			 msAndroid.toast("请选择您对本次服务的评价.");
			 return;
		}
		var formJson=msAndroid.changedTicketVO("#form");
		var url=$("#form").attr("action");
		var attJson=msAndroid.attVO("#form");
		if(attJson.original!=null){
			msAndroid.post("/tickets/{{ticketId}}/attachments/info",attJson,"post");
		}
		var btn = this;
		msAndroid.post(url,formJson,"put","active",function(){
			btn.disabled = false;
		});
		//禁止页面二次提交
	 	btn.disabled = true;
	});
	//删除在H5页面添加的voice附件dom
	function removeVoice(el){
		$(el).parents('.voice-over').remove();
	};
</script>
</html>